package com.GlobalPaint.app.Base;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.GlobalPaint.app.R;


public class DialogWaiting extends Dialog {

	public static Dialog createDialogWaiting(Context context, String sMsg) {
		LayoutInflater inflater = LayoutInflater.from(context);
		View v = inflater.inflate(R.layout.common_dlg_waiting, null);
		LinearLayout layout = (LinearLayout)v.findViewById(R.id.layout_waiting);

		ImageView imgWaiting = (ImageView)v.findViewById(R.id.img_waiting);
		TextView txtView = (TextView)v.findViewById(R.id.txt_name);
		
		Animation animWaiting = AnimationUtils.loadAnimation(context, R.anim.waitingloading);
		
		imgWaiting.setAnimation(animWaiting);
		txtView.setText(sMsg);
		
		Dialog waitingDlg = new Dialog(context, R.style.waiting_dialog);
		waitingDlg.setCancelable(false);
		waitingDlg.setContentView(layout, new LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT));

		return waitingDlg;
	}

	public DialogWaiting(Context context, int theme) {
		super(context, theme);
		// TODO Auto-generated constructor stub
	}

	public DialogWaiting(Context context, boolean cancelable, OnCancelListener cancelListener) {
		super(context, cancelable, cancelListener);
		// TODO Auto-generated constructor stub
	}

}
